package com.qiyue.admin.entity.base;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.qiyue.common.model.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;

/**
 * Created by y747718944 on 2018/2/7
 */
@Entity
@Table(name = "base_resource_authority")
@ApiModel("资源权限表")
public class ResourceAuthority  extends BaseEntity{

    @Column(name = "authority_id" , length = 16)
    private Long authorityId;

    @Column(name = "authority_type", length = 16)
    private String authorityType;

    @Column(name = "resource_type", length = 16)
    private String resourceType;

    @Column(name = "parent_id", length = 16)
    private Long parentId;
    @Column(name = "path", length = 16)
    private String path;
    @Column(name = "description", length = 32)
    private String description;




    public ResourceAuthority() {
    }

    public ResourceAuthority(String authorityType, String resourceType) {
        this.authorityType = authorityType;
        this.resourceType = resourceType;
    }

    public Long getAuthorityId() {
        return authorityId;
    }

    public void setAuthorityId(Long authorityId) {
        this.authorityId = authorityId;
    }

    public String getAuthorityType() {
        return authorityType;
    }

    public void setAuthorityType(String authorityType) {
        this.authorityType = authorityType;
    }



    public String getResourceType() {
        return resourceType;
    }

    public void setResourceType(String resourceType) {
        this.resourceType = resourceType;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }





    @ApiModelProperty(value = "resource关联menu 多对一")
    public Menu menu;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "menu_id")
    @JsonIgnore
    public Menu getMenu() {
        return menu;
    }

    public void setMenu(Menu menu) {
        this.menu = menu;
    }
    @ApiModelProperty(value = "resource关联element 多对一")
    private  Element element;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "element_id")
    @JsonIgnore
    public Element getElement() {
        return element;
    }

    public void setElement(Element element) {
        this.element = element;
    }
}
